SetAxisCam

连结轴并开始凸轮运动。

语法

KsCommandStatus SetAxisCam(
     int Master,
     int Slave,
     BOOL Permanent,
     double MasterOffset,
     double SlaveOffset,
     double MasterScaling,
     double SlaveScaling,
     McCamStartMode StartMode,
     double StartParameter,
     McSource MasterValueSource,
     int Cam,
     McBufferMode BufferMode
);

参数

Master [in]:主轴索引。索引以零为起点;别名将影响此参数。

Slave [in]:从轴索引。索引以零为起点;别名将影响此参数。从轴之最大数量为 32 轴。

Permanent [in]:决定马达停用后是否保留凸轮状态。

TRUE:马达停用但保留凸轮状态,例如当主轴启用时从轴也会跟著启用,而当主轴发生错误从轴也会发生错误。

FALSE:马达停用后不会保留凸轮状态。

MasterOffset [in]:凸轮表中主轴位置的偏移量。

SlaveOffset [in]:凸轮表中从轴位置的偏移量。

MasterScaling [in]:主设定档因子(预设值 = 1.0),以从轴的角度来看,该因子乘以整个主设定档。

SlaveScaling [in]:从设定档因子(预设值 = 1.0),该因子乘以整个从设定档。

StartMode [in]:从轴所用的凸轮模式。请见 McCamStartMode 类型

StartParameter [in]:依选择的斜坡而定,若为 camRampDistanceStartParameter 即为从轴移动的距离,单位为计数;若为 camRampTimeStartParameter 即为从轴移动的时间,每秒为一单位。该参数使用主轴的资讯来决定如何移动从轴,而距离取决于主轴移动的距离。

MasterValueSource [in]:定义同步的来源。请见 McSource 类型

Cam [in]:凸轮表的索引,连接到 SetCamTable 的输出。 .

BufferMode [in]:定义如何融合两功能的速度,请见 McBufferMode 类型

回传值

返回 KsCommandStatus 结构。

备注

范例

KsCommandStatus AssignCamSlave(INT Master, INT Slave, INT Table) {
   BOOL InSync = FALSE;
   BOOL Busy = FALSE;
   BOOL Active = FALSE;
   BOOL CommandAborted = FALSE;
   BOOL Error = FALSE;
   WORD ErrorId = 0;
   INT QueueIndex = -1;
   BOOL EndOfProfile = FALSE;
   KsCommandStatus cam = SetAxisCam(Master, Slave, FALSE,
      0, //Master Offset. Offset to add to the master positions in the CAM table
      0, //Slave Offset. Offset to add to the slave positions in the CAM table
      1, /*Master Scaling. Ratio to apply to the distance between 
           the master positions and the original position*/
      1, //Slave Scaling. Ratio to apply to the slave positions in the CAM table
      camRelative, //StartMode. 
         /*Absolute: The slave axis will jump to its target in the table.
           Alarms may be triggered if the position is too far.*/
         //Relative: The current master/slave positions are used as origin for the CAM table.
         /*Ramp Distance: The slave axis will ramp to its target position
           while the master axis moves along the distance provided in StartParameter*/
         /*Ramp Time: The slave axis will ramp to its target position
           over the period of time provided in seconds in StartParameter*/
      0, //Start Parameter 
      mcSetValue, /*Master Value Source. Value of the master position used.
                    Cam be the target position (commanded value and set value are identical)
                    or the actual position.*/
      Table,
      mcAborting
   );
   return cam;
}

使用需求

  RT Win32
最低支援版本 4.0 4.0
标头档 ksmotion.h ksmotion.h
程式库 KsApi_Rtss.lib KsApi.lib

参见

GetAxisCamInfo

GetCamTable

PowerAxis

ReleaseAxis

SetCamTable

SimulateAxisCam

StopAxis